package main

import "fmt"

// 父类
type Human struct {
	Name string
	Age  int
}

func (human *Human) Eat() {
	fmt.Println("human eat")
}
func (human *Human) Sleep() {
	fmt.Println("human sleep")
}

// ----------------------------------------------------------------

//子类
type Student struct {
	Human
	Score int
}

// 可以重写父类的eat 方法

func (student *Student) Eat() {
	fmt.Println("student eat")
}

func main() {
	var xiaoming Student
	xiaoming.Name = "xiaoming"
	xiaoming.Eat()
	xiaoming.Sleep()
}
